<?php 

$auth = $_SESSION['auth'];
if (empty($auth)) die('用户未登录！^_^');

if (empty($_POST['forum_id'])) die();

$forum_id = intval($_POST['forum_id']);
$title = filter_var($_POST['title'], FILTER_SANITIZE_STRING);
$content = cleanjs($_POST['content']);
$orders = empty($_POST['orders']) ? 0 : 1;

$forum = dt_query_one("SELECT id, name, kind, ext FROM forum WHERE id = $forum_id");
if (!$forum) die('获取数据失败！^_^');

?>
<?php require_once('inc/umediter_text.html') ?> 
<div class="container">
	<div class="row clearfix">
		<ol class="breadcrumb forum-breadcrumb">
			<li><a href="?c=forum"><span class="glyphicon glyphicon-home"></span> 首页</a></li>
			<?php if (0 != $forum['kind']) { ?>
			<li><a href="?c=forum&a=forum_list&m_falter=5&kind=<?php echo $forum['kind'] ?>"><img src="img/finance/hengxin_logo_sm_1.png" height="25px"> <?php echo dt_query_one("SELECT name FROM forum_kind WHERE id = ".$forum['kind'])['name'] ?></a></li>
			<?php } ?>
			<li><a href="?c=forum&a=topic_list&forum_id=<?php echo $forum['id'] ?>"><?php echo $forum['name'] ?></a></li>
			<li class="active">付费发布</li>
		</ol>
	</div>
</div>
<div class="container">
	<div class="forum-add pay">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<h3><span class="glyphicon glyphicon-edit"></span> 在 [<?php echo $forum['name'] ?>] 付费发布</h3>
				<hr class="solid">
				<div class="alert alert-danger" role="alert">
					<b>付费发布：</b>
					<ol>
						<li>置顶发布：每1元置顶8分钟，金额高位置靠前。</li>
						<li>首页展示：置顶期限内始终首页展示。</li>
						<li>自动推荐：付费信息自动设置为推荐，且任何用户无权取消推荐。</li>
						<li>删除保护：除自己外任何用户无权删除付费信息。</li>
					</ol>
				</div>
				<div class="col-md-11 column">
					<form class="form-horizontal" id="do_topic_add" action="javascript:do_pay_topic_add(<?php echo $forum_id ?>)">
						<fieldset>
							<!-- forum_id -->
							<input type="hidden" name="forum_id" value="<?php echo $forum_id ?>"/>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">标题</label>  
								<div class="col-md-9">
									<input name="title" type="text" placeholder="某某话题" class="form-control input-md" required="" value="<?php echo $title ?>">
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">内容</label>  
								<div class="col-md-9">
									<textarea class="form-control input-lg" id="topic_content" name="content" style="width:105%;height:360px" required=""><?php echo $content?></textarea>
								</div>
							</div>
							<?php if (0 != $forum['ext']) { ?>
							<?php require_once('forum_ext/ext_'.$forum['ext'].'/topic_add.phtml') ?>
							<?php } ?>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">功能选择</label>  
								<div class="col-md-2">
									<div class="checkbox"><label><input name="orders" type="checkbox" onclick="check_topic_orders()" <?php if (1 == $orders) echo 'checked="checkbox"' ?>> 下单功能 </label></div>
								</div>
								<div class="col-md-7" id="topic_orders_s" style="<?php if (0 == $orders) echo 'display:none' ?>">
									<div class="row clearfix">
										<label class="col-md-2 control-label">设置时间</label>  
										<div class="col-md-5">
											<label class="radio-inline"> <input type="radio" name="start_t" value="0" onclick="check_start_t(0)" checked="checked" > 不设置 </label>
											<label class="radio-inline"> <input type="radio" name="start_t" value="1" onclick="check_start_t(1)" > 开始 </label>
											<label class="radio-inline"> <input type="radio" name="start_t" value="2" onclick="check_start_t(2)" > 结束 </label>
										</div>
										<div class="col-md-5">
											<input id="start_t_s" name="start_t_s" type="text" placeholder="格式：0000-00-00 00:00:00" class="form-control input-md" style="display:none" value="<?php echo date('Y-m-d H:i:s', time()) ?>" >
										</div>
									</div>
									<br>
									<div class="row clearfix">
										<label class="col-md-2 control-label">最大订单</label>  
										<div class="col-md-4">
											<label class="radio-inline"> <input type="radio" name="order_l" value="0" onclick="check_order_l(0)" checked="checked" > 不限制 </label>
											<label class="radio-inline"> <input type="radio" name="order_l" value="1" onclick="check_order_l(1)" > 限制 </label>
										</div>
										<div class="col-md-6">
											<input id="order_l_n" name="order_l_n" type="text" placeholder="最大订单量" class="form-control input-md" style="display:none" >
										</div>
									</div>
									<br>
									<div class="row clearfix">
										<label class="col-md-2 control-label">跳转链接</label>  
										<div class="col-md-4">
											<label class="radio-inline"> <input type="radio" name="out_s" value="0" onclick="check_out_s(0)" checked="checked" > 不设置 </label>
											<label class="radio-inline"> <input type="radio" name="out_s" value="1" onclick="check_out_s(1)" > 设置 </label>
										</div>
										<div class="col-md-6">
											<input id="out_s_u" name="out_s_u" type="text" placeholder="http://hiici.com/" class="form-control input-md" style="display:none" >
										</div>
									</div>
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">支付金额（元）</label>  
								<div class="col-md-9">
									<input name="pay" type="text" placeholder="0.00" class="form-control input-md" required="">
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">密码</label>  
								<div class="col-md-9">
									<input id="password" name="password" type="password" placeholder="密码" class="form-control input-md" required="">
								</div>
							</div>
							<!-- token -->
							<input type="hidden" name="token" value="<?php echo get_token() ?>"/>
							<!-- Button -->
							<div class="form-group">
								<label class="col-md-2 control-label"></label>
								<div class="col-md-3">
									<button class="btn btn-danger btn-block">确认付费发布</button>
								</div>
								<div class="col-md-6">
								</div>
							</div>
						</fieldset>
					</form>	


				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">

var topic_content = UM.getEditor("topic_content");  

$(document).ready(function(){
});

</script>
